package com.whw.fy.controller;

import com.whw.fy.entity.CourseSummary;
import com.whw.fy.entity.Message;
import com.whw.fy.entity.TeachSummary;
import com.whw.fy.service.CourseSummaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Date;

@Api(tags = " 课程总结模块")
@RestController
@RequestMapping("/api/courseSummary")
public class CourseSummaryController {
    @Resource
    private CourseSummaryService courseSummaryService;

    @ApiOperation(value = "添加课程总结记录")
    @PostMapping("/insert")
    public Message insert(CourseSummary courseSummary) {
        courseSummary.setCourseSummaryPostTime(new Date());
        return courseSummaryService.insertSelective(courseSummary);
    }

    @ApiOperation(value = "修改课程总结")
    @PostMapping("/update")
    public Message update(CourseSummary courseSummary){
        return courseSummaryService.updateByPrimaryKeySelective(courseSummary);
    }

    @ApiOperation(value = "根据id查看课程总结")
    @GetMapping("/one")
    public Message selectById(int id){
        return courseSummaryService.selectByPrimaryKey(id);
    }

    @ApiOperation(value = "查看所有课程总结")
    @GetMapping("/all")
    public Message selectALL(){
        return courseSummaryService.selectAll();
    }

    @ApiOperation(value = "根据授课老师id查询旗下获取所有课程总结")
    @GetMapping("/all/TeacherIdJurisdictionEight")
    public Message selectallByTeacherIdJurisdictionEight(int staffId){
        return courseSummaryService.selectallByTeacherIdJurisdictionEight(staffId);
    }

    @ApiOperation(value = "根据医疗主管id查询旗下课程总结")
    @GetMapping("/all/MedicalDirectorIdJurisdictionZero")
    public Message selectallByMedicalDirectorIdJurisdictionZero(int staffId){
        return courseSummaryService.selectallByMedicalDirectorIdJurisdictionZero(staffId);
    }

    @ApiOperation(value = "根据主责老师id查询旗下所有课程总结")
    @GetMapping("/all/principalTeacherJurisdictionSeven")
    public Message selectallByprincipalTeacherJurisdictionSeven(int staffId){
        return courseSummaryService.selectallByprincipalTeacherJurisdictionSeven(staffId);
    }

    @ApiOperation(value = "根据教学主管id查询旗下所有课程总结")
    @GetMapping("/all/TeachingDirectorJurisdictionSix")
    public Message selectallByTeachingDirectorJurisdictionSix(int staffId){
        return courseSummaryService.selectallByTeachingDirectorJurisdictionSix(staffId);
    }

    @ApiOperation(value = "教学主管批复")
    @PostMapping("/update/replyTeachingDirector")
    public Message updateReplyTeachingDirector(CourseSummary courseSummary){
        courseSummary.setCourseSummaryReplyTeachingDirectorTime(new Date());
        return courseSummaryService.updateReplyTeachingDirector(courseSummary);
    }

    @ApiOperation(value = "主责老师批复")
    @PostMapping("/update/replyPrincipalTeacher")
    public Message updateReplyPrincipalTeacher(CourseSummary courseSummary){
        courseSummary.setCourseSummaryReplyPrincipalTeacherTime(new Date());
        return courseSummaryService.updateReplyPrincipalTeacher(courseSummary);
    }
}
